package com.ruoyi.worker.controller;

import com.repair.api.worker.request.param.WorkerQueryParam;
import com.repair.api.worker.response.data.WorkerInfo;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.worker.service.AdminWorkerService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * Created by IntelliJ IDEA.
 *
 * @author zq
 * @version 1.0
 * @create 2024-10-20 19:16
 * @since jdk1.8
 */
@Api(tags = "师傅人员模块")
@RestController
@RequestMapping("/admin/worker")
public class AdminWorkerController {
    @Autowired
    private AdminWorkerService adminWorkerService;

    @ApiOperation("查询全部师傅人员")
    @GetMapping("/getAllWorkers")
    public R<TableDataInfo> getAllWorker(WorkerQueryParam workerQueryParam) {
        TableDataInfo tableDataInfo = adminWorkerService.getAllWorker(workerQueryParam);
        return R.ok(tableDataInfo);
    }

    @ApiOperation("拉黑师傅")
    @PostMapping("/blockWorker/{id}")
    public R<WorkerInfo> blockWorker(@PathVariable Long id) {
        adminWorkerService.blockWorker(id);
        return R.ok();
    }
    @ApiOperation("取消拉黑师傅")
    @PostMapping("/cancelBlockWorker/{id}")
    public R<WorkerInfo> cancelBlockWorker(@PathVariable Long id) {
        adminWorkerService.cancelBlockWorker(id);
        return R.ok();
    }

    @ApiOperation("查询全部拉黑师傅")
    @GetMapping("/getBlockWorker")
    public R<TableDataInfo> getBlockWorker(WorkerQueryParam workerQueryParam) {
        TableDataInfo tableDataInfo = adminWorkerService.getBlockWorker(workerQueryParam);
        return R.ok(tableDataInfo);
    }

  /*  @ApiOperation("获取师傅详情")
    @GetMapping("/getWorkerDetail")
    public JsonResult<WorkerInfo> getWorkerDetail(@RequestParam("workerId") String workerId) {
        WorkerInfo workerInfo = adminWorkerService.getWorkerDetail(workerId);
        return JsonResult.ok(workerInfo);
    }*/
 /*   @ApiOperation("删除师傅")
    @DeleteMapping("/deleteWorker")
    public JsonResult deleteWorker(@RequestParam("workerId") String workerId) {
        adminWorkerService.deleteWorker(workerId);
        return JsonResult.ok();
    }*/
}
